package com.wsl.sale.redis.controller;

import com.wsl.sale.redis.dao.PersonDao;
import com.wsl.sale.redis.entity.Person;
import com.wsl.sale.redis.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:wangshuliang
 * @Description:
 * @Date:Created in 9:16 2019/5/4
 * @Modified by:
 */
@RestController
public class DataController {
    @Autowired
    HelloService helloService;
    @Autowired
    private PersonDao personDao;
    @RequestMapping("/set")
    public void set(){
        Person wsl = new Person("1", "wsl", 32);
        personDao.save(wsl);
        personDao.stringRedisTemplateDemo();
    }

    @RequestMapping("/getStr")
    public String getStr(){
        return personDao.getString();
    }
    @RequestMapping("/getPerson")
    public Person getPerson(){
        return personDao.getPerson();
    }

    @RequestMapping("hello")
    public String getHello(){
        return helloService.get("wsl").toString();
    }

}
